package com.numberone.master.modules.profit.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.numberone.master.common.persistence.Page;
import com.numberone.master.common.service.CrudService;
import com.numberone.master.modules.profit.entity.Account;
import com.numberone.master.modules.profit.entity.AccountInfo;
import com.numberone.master.modules.sys.service.OfficeService;
import com.numberone.master.modules.profit.dao.AccountDao;
import com.numberone.master.modules.profit.dao.AccountInfoDao;

/**
 * 账户信息Service
 * @author chengkang
 * @version 2018-02-12
 */
@Service
@Transactional(readOnly = true)
public class AccountInfoService extends CrudService<AccountInfoDao, AccountInfo> {
	
	@Autowired
	private AccountInfoDao accountInfoDao;

	public AccountInfo get(String id) {
		return super.get(id);
	}
	
	public List<AccountInfo> findList(AccountInfo account) {
		return super.findList(account);
	}
	
	public Page<AccountInfo> findPage(Page<AccountInfo> page, AccountInfo account) {
		return super.findPage(page, account);
	}
	
	@Transactional(readOnly = false)
	public void save(AccountInfo account) {
		super.save(account);
	}
	@Transactional(readOnly = false)
	public void update(AccountInfo account) {
		super.update(account);
	}
	
	@Transactional(readOnly = false)
	public void delete(AccountInfo account) {
		super.delete(account);
	}
	
	@Transactional(readOnly = false)
	public AccountInfo getBalance(String office_id) {
		return accountInfoDao.getBalance(office_id);
	}
	
	@Transactional(readOnly = false)
	public Double getTaskMoney(String officeId){
		return accountInfoDao.getTaskMoney(officeId);
	}
	
	@Transactional(readOnly = false)
	public Double getArrivalMoney(String officeId){
		return accountInfoDao.getArrivalMoney(officeId);
	}
	
	@Transactional(readOnly = true)
	public AccountInfo getAccountByOfficeId(String officeId) {
		return accountInfoDao.getAccountByOfficeId(officeId);
	}
}